package org.edu.modules.research.rwork.service.impl;

import org.edu.common.base.BasePageDto;
import org.edu.common.base.BaseServiceImpl;
import org.edu.common.utils.ConvertUtils;
import org.edu.common.base.BaseServiceImpl;
import org.edu.modules.research.rwork.mapper.VeJkyMeetUserMapper;
import org.edu.modules.research.rwork.entity.VeJkyMeetUser;
import org.edu.modules.research.rwork.dto.VeJkyMeetUserDto;
import org.edu.modules.research.rwork.service.VeJkyMeetUserService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 实现类
 */
@Service
public class VeJkyMeetUserServiceImpl extends BaseServiceImpl<VeJkyMeetUser, VeJkyMeetUserMapper> implements VeJkyMeetUserService {

    @Override
    public void deleteByPid(String pid) {
        mapper.deleteByPid(pid);
    }

    public IPage<VeJkyMeetUserDto> pageDto(BasePageDto page, @Param(Constants.WRAPPER) Wrapper queryWrapper){
        return mapper.pageDto(page,queryWrapper);
    }
    /**
    * 查询实体类
    */
    public VeJkyMeetUserDto findDtoById(String id) {
        VeJkyMeetUser entity = super.findById(id);
        VeJkyMeetUserDto dto = ConvertUtils.convertToDto(entity, VeJkyMeetUserDto.class);
        return dto;
    }

    @Override
    public List<VeJkyMeetUserDto> findLitByMeetId(String meetId) {
        return mapper.findLitByMeetId(meetId);
    }

    /**
    * 新增或者修改
    */
    public void insertOrUpdate(VeJkyMeetUserDto dto,Boolean isAdd){
        if(isAdd){
            super.insert(dto);
        }else{
            super.update(dto);
        }
    }

}
